package com.firexxx.study.designmodel.jdkproxy;

import java.lang.reflect.Proxy;

/**
 * @description: TODO
 * @throws:
 * @author: zhuangzhang2
 * @date: 2020/03/08 19:50
 */
public class MyProxyFactory {

    public static Object getProxy(Object target) {
        ProxyInvocationHandler handle = new ProxyInvocationHandler();
        handle.setTarget(target);
        Object proxy = Proxy.newProxyInstance(target.getClass().getClassLoader(), target.getClass().getInterfaces(), handle);
        return proxy;
    }

}